package com.atguigu.jxc.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.DamageList;
import com.atguigu.jxc.entity.DamageListGoods;
import com.atguigu.jxc.service.DamageListGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author 杨林
 * @create 2023-01-29 16:11 星期日
 * description:
 */
@RestController
@RequestMapping("/damageListGoods")
public class DamageListGoodsController {

    @Autowired
    DamageListGoodsService damageListGoodsService;

    /**
     * 保存报损单
     * @return
     */
    @PostMapping("/save")
    public ServiceVO save( DamageList damageList,  String damageListGoodsStr){

        return damageListGoodsService.save(damageList,damageListGoodsStr);
    }

    /**
     * 报损单查询
     * @param sTime
     * @param eTime
     * @return
     */
    @PostMapping("/list")
    public Map<String,Object> list(String  sTime, String  eTime){

        return damageListGoodsService.list(sTime,eTime);
    }

    /**
     * 查询报损单商品信息
     * @param damageListId
     * @return
     */
    @PostMapping("/goodsList")
    public Map<String,Object> goodsList(Integer damageListId){

        return damageListGoodsService.goodsList(damageListId);
    }
}
